// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/*!
 * @file ddsProtocol.cpp
 * This source file contains the implementation of the described types in the IDL file.
 *
 * This file was generated by the tool fastddsgen.
 */

#ifdef _WIN32
// Remove linker warning LNK4221 on Visual Studio
namespace {
char dummy;
}  // namespace
#endif  // _WIN32

#include "ddsProtocol.h"

#include <fastcdr/Cdr.h>


#include <fastcdr/exceptions/BadParamException.h>
using namespace eprosima::fastcdr::exception;

#include <utility>




ProtocolSuite::ProtocolSuite()
{
}

ProtocolSuite::~ProtocolSuite()
{
}

ProtocolSuite::ProtocolSuite(
        const ProtocolSuite& x)
{
    m_DevType = x.m_DevType;
    m_SrcDevType = x.m_SrcDevType;
    m_SrcDevNum = x.m_SrcDevNum;
    m_DstDevType = x.m_DstDevType;
    m_DstDevNum = x.m_DstDevNum;
    m_CmdType = x.m_CmdType;
    m_CmdChildType = x.m_CmdChildType;
    m_devState = x.m_devState;
    m_DataLen = x.m_DataLen;
    m_Message = x.m_Message;
    m_Index = x.m_Index;
}

ProtocolSuite::ProtocolSuite(
        ProtocolSuite&& x) noexcept
{
    m_DevType = x.m_DevType;
    m_SrcDevType = x.m_SrcDevType;
    m_SrcDevNum = x.m_SrcDevNum;
    m_DstDevType = x.m_DstDevType;
    m_DstDevNum = x.m_DstDevNum;
    m_CmdType = x.m_CmdType;
    m_CmdChildType = x.m_CmdChildType;
    m_devState = x.m_devState;
    m_DataLen = x.m_DataLen;
    m_Message = std::move(x.m_Message);
    m_Index = x.m_Index;
}

ProtocolSuite& ProtocolSuite::operator =(
        const ProtocolSuite& x)
{

    m_DevType = x.m_DevType;
    m_SrcDevType = x.m_SrcDevType;
    m_SrcDevNum = x.m_SrcDevNum;
    m_DstDevType = x.m_DstDevType;
    m_DstDevNum = x.m_DstDevNum;
    m_CmdType = x.m_CmdType;
    m_CmdChildType = x.m_CmdChildType;
    m_devState = x.m_devState;
    m_DataLen = x.m_DataLen;
    m_Message = x.m_Message;
    m_Index = x.m_Index;
    return *this;
}

ProtocolSuite& ProtocolSuite::operator =(
        ProtocolSuite&& x) noexcept
{

    m_DevType = x.m_DevType;
    m_SrcDevType = x.m_SrcDevType;
    m_SrcDevNum = x.m_SrcDevNum;
    m_DstDevType = x.m_DstDevType;
    m_DstDevNum = x.m_DstDevNum;
    m_CmdType = x.m_CmdType;
    m_CmdChildType = x.m_CmdChildType;
    m_devState = x.m_devState;
    m_DataLen = x.m_DataLen;
    m_Message = std::move(x.m_Message);
    m_Index = x.m_Index;
    return *this;
}

bool ProtocolSuite::operator ==(
        const ProtocolSuite& x) const
{
    return (m_DevType == x.m_DevType &&
           m_SrcDevType == x.m_SrcDevType &&
           m_SrcDevNum == x.m_SrcDevNum &&
           m_DstDevType == x.m_DstDevType &&
           m_DstDevNum == x.m_DstDevNum &&
           m_CmdType == x.m_CmdType &&
           m_CmdChildType == x.m_CmdChildType &&
           m_devState == x.m_devState &&
           m_DataLen == x.m_DataLen &&
           m_Message == x.m_Message &&
           m_Index == x.m_Index);
}

bool ProtocolSuite::operator !=(
        const ProtocolSuite& x) const
{
    return !(*this == x);
}

/*!
 * @brief This function sets a value in member DevType
 * @param _DevType New value for member DevType
 */
void ProtocolSuite::DevType(
        uint8_t _DevType)
{
    m_DevType = _DevType;
}

/*!
 * @brief This function returns the value of member DevType
 * @return Value of member DevType
 */
uint8_t ProtocolSuite::DevType() const
{
    return m_DevType;
}

/*!
 * @brief This function returns a reference to member DevType
 * @return Reference to member DevType
 */
uint8_t& ProtocolSuite::DevType()
{
    return m_DevType;
}


/*!
 * @brief This function sets a value in member SrcDevType
 * @param _SrcDevType New value for member SrcDevType
 */
void ProtocolSuite::SrcDevType(
        uint8_t _SrcDevType)
{
    m_SrcDevType = _SrcDevType;
}

/*!
 * @brief This function returns the value of member SrcDevType
 * @return Value of member SrcDevType
 */
uint8_t ProtocolSuite::SrcDevType() const
{
    return m_SrcDevType;
}

/*!
 * @brief This function returns a reference to member SrcDevType
 * @return Reference to member SrcDevType
 */
uint8_t& ProtocolSuite::SrcDevType()
{
    return m_SrcDevType;
}


/*!
 * @brief This function sets a value in member SrcDevNum
 * @param _SrcDevNum New value for member SrcDevNum
 */
void ProtocolSuite::SrcDevNum(
        uint8_t _SrcDevNum)
{
    m_SrcDevNum = _SrcDevNum;
}

/*!
 * @brief This function returns the value of member SrcDevNum
 * @return Value of member SrcDevNum
 */
uint8_t ProtocolSuite::SrcDevNum() const
{
    return m_SrcDevNum;
}

/*!
 * @brief This function returns a reference to member SrcDevNum
 * @return Reference to member SrcDevNum
 */
uint8_t& ProtocolSuite::SrcDevNum()
{
    return m_SrcDevNum;
}


/*!
 * @brief This function sets a value in member DstDevType
 * @param _DstDevType New value for member DstDevType
 */
void ProtocolSuite::DstDevType(
        uint8_t _DstDevType)
{
    m_DstDevType = _DstDevType;
}

/*!
 * @brief This function returns the value of member DstDevType
 * @return Value of member DstDevType
 */
uint8_t ProtocolSuite::DstDevType() const
{
    return m_DstDevType;
}

/*!
 * @brief This function returns a reference to member DstDevType
 * @return Reference to member DstDevType
 */
uint8_t& ProtocolSuite::DstDevType()
{
    return m_DstDevType;
}


/*!
 * @brief This function sets a value in member DstDevNum
 * @param _DstDevNum New value for member DstDevNum
 */
void ProtocolSuite::DstDevNum(
        uint8_t _DstDevNum)
{
    m_DstDevNum = _DstDevNum;
}

/*!
 * @brief This function returns the value of member DstDevNum
 * @return Value of member DstDevNum
 */
uint8_t ProtocolSuite::DstDevNum() const
{
    return m_DstDevNum;
}

/*!
 * @brief This function returns a reference to member DstDevNum
 * @return Reference to member DstDevNum
 */
uint8_t& ProtocolSuite::DstDevNum()
{
    return m_DstDevNum;
}


/*!
 * @brief This function sets a value in member CmdType
 * @param _CmdType New value for member CmdType
 */
void ProtocolSuite::CmdType(
        uint8_t _CmdType)
{
    m_CmdType = _CmdType;
}

/*!
 * @brief This function returns the value of member CmdType
 * @return Value of member CmdType
 */
uint8_t ProtocolSuite::CmdType() const
{
    return m_CmdType;
}

/*!
 * @brief This function returns a reference to member CmdType
 * @return Reference to member CmdType
 */
uint8_t& ProtocolSuite::CmdType()
{
    return m_CmdType;
}


/*!
 * @brief This function sets a value in member CmdChildType
 * @param _CmdChildType New value for member CmdChildType
 */
void ProtocolSuite::CmdChildType(
        uint8_t _CmdChildType)
{
    m_CmdChildType = _CmdChildType;
}

/*!
 * @brief This function returns the value of member CmdChildType
 * @return Value of member CmdChildType
 */
uint8_t ProtocolSuite::CmdChildType() const
{
    return m_CmdChildType;
}

/*!
 * @brief This function returns a reference to member CmdChildType
 * @return Reference to member CmdChildType
 */
uint8_t& ProtocolSuite::CmdChildType()
{
    return m_CmdChildType;
}


/*!
 * @brief This function sets a value in member devState
 * @param _devState New value for member devState
 */
void ProtocolSuite::devState(
        uint8_t _devState)
{
    m_devState = _devState;
}

/*!
 * @brief This function returns the value of member devState
 * @return Value of member devState
 */
uint8_t ProtocolSuite::devState() const
{
    return m_devState;
}

/*!
 * @brief This function returns a reference to member devState
 * @return Reference to member devState
 */
uint8_t& ProtocolSuite::devState()
{
    return m_devState;
}


/*!
 * @brief This function sets a value in member DataLen
 * @param _DataLen New value for member DataLen
 */
void ProtocolSuite::DataLen(
        uint32_t _DataLen)
{
    m_DataLen = _DataLen;
}

/*!
 * @brief This function returns the value of member DataLen
 * @return Value of member DataLen
 */
uint32_t ProtocolSuite::DataLen() const
{
    return m_DataLen;
}

/*!
 * @brief This function returns a reference to member DataLen
 * @return Reference to member DataLen
 */
uint32_t& ProtocolSuite::DataLen()
{
    return m_DataLen;
}


/*!
 * @brief This function copies the value in member Message
 * @param _Message New value to be copied in member Message
 */
void ProtocolSuite::Message(
        const std::vector<uint8_t>& _Message)
{
    m_Message = _Message;
}

/*!
 * @brief This function moves the value in member Message
 * @param _Message New value to be moved in member Message
 */
void ProtocolSuite::Message(
        std::vector<uint8_t>&& _Message)
{
    m_Message = std::move(_Message);
}

/*!
 * @brief This function returns a constant reference to member Message
 * @return Constant reference to member Message
 */
const std::vector<uint8_t>& ProtocolSuite::Message() const
{
    return m_Message;
}

/*!
 * @brief This function returns a reference to member Message
 * @return Reference to member Message
 */
std::vector<uint8_t>& ProtocolSuite::Message()
{
    return m_Message;
}


/*!
 * @brief This function sets a value in member Index
 * @param _Index New value for member Index
 */
void ProtocolSuite::Index(
        uint32_t _Index)
{
    m_Index = _Index;
}

/*!
 * @brief This function returns the value of member Index
 * @return Value of member Index
 */
uint32_t ProtocolSuite::Index() const
{
    return m_Index;
}

/*!
 * @brief This function returns a reference to member Index
 * @return Reference to member Index
 */
uint32_t& ProtocolSuite::Index()
{
    return m_Index;
}




text_message::text_message()
{
}

text_message::~text_message()
{
}

text_message::text_message(
        const text_message& x)
{
    m_from = x.m_from;
    m_to = x.m_to;
    m_msg = x.m_msg;
}

text_message::text_message(
        text_message&& x) noexcept
{
    m_from = std::move(x.m_from);
    m_to = std::move(x.m_to);
    m_msg = std::move(x.m_msg);
}

text_message& text_message::operator =(
        const text_message& x)
{

    m_from = x.m_from;
    m_to = x.m_to;
    m_msg = x.m_msg;
    return *this;
}

text_message& text_message::operator =(
        text_message&& x) noexcept
{

    m_from = std::move(x.m_from);
    m_to = std::move(x.m_to);
    m_msg = std::move(x.m_msg);
    return *this;
}

bool text_message::operator ==(
        const text_message& x) const
{
    return (m_from == x.m_from &&
           m_to == x.m_to &&
           m_msg == x.m_msg);
}

bool text_message::operator !=(
        const text_message& x) const
{
    return !(*this == x);
}

/*!
 * @brief This function copies the value in member from
 * @param _from New value to be copied in member from
 */
void text_message::from(
        const std::string& _from)
{
    m_from = _from;
}

/*!
 * @brief This function moves the value in member from
 * @param _from New value to be moved in member from
 */
void text_message::from(
        std::string&& _from)
{
    m_from = std::move(_from);
}

/*!
 * @brief This function returns a constant reference to member from
 * @return Constant reference to member from
 */
const std::string& text_message::from() const
{
    return m_from;
}

/*!
 * @brief This function returns a reference to member from
 * @return Reference to member from
 */
std::string& text_message::from()
{
    return m_from;
}


/*!
 * @brief This function copies the value in member to
 * @param _to New value to be copied in member to
 */
void text_message::to(
        const std::string& _to)
{
    m_to = _to;
}

/*!
 * @brief This function moves the value in member to
 * @param _to New value to be moved in member to
 */
void text_message::to(
        std::string&& _to)
{
    m_to = std::move(_to);
}

/*!
 * @brief This function returns a constant reference to member to
 * @return Constant reference to member to
 */
const std::string& text_message::to() const
{
    return m_to;
}

/*!
 * @brief This function returns a reference to member to
 * @return Reference to member to
 */
std::string& text_message::to()
{
    return m_to;
}


/*!
 * @brief This function copies the value in member msg
 * @param _msg New value to be copied in member msg
 */
void text_message::msg(
        const std::string& _msg)
{
    m_msg = _msg;
}

/*!
 * @brief This function moves the value in member msg
 * @param _msg New value to be moved in member msg
 */
void text_message::msg(
        std::string&& _msg)
{
    m_msg = std::move(_msg);
}

/*!
 * @brief This function returns a constant reference to member msg
 * @return Constant reference to member msg
 */
const std::string& text_message::msg() const
{
    return m_msg;
}

/*!
 * @brief This function returns a reference to member msg
 * @return Reference to member msg
 */
std::string& text_message::msg()
{
    return m_msg;
}


// Include auxiliary functions like for serializing/deserializing.
#include "ddsProtocolCdrAux.ipp"

